import {
  COUPON_LIST, COUPON_RECEIVE
} from '@constants/coupon'
import {
  API_COUPON_LIST, API_COUPON_RECEIVE
} from '@constants/api'
import { createAction } from '@utils/redux'

/**
 * 优惠券列表
 * @param {*} payload
 */
export const dispatchCouponList = payload => createAction({
  url: API_COUPON_LIST,
  type: COUPON_LIST,
  fetchOptions: {
    autoLogin: false
  },
  payload
})

/**
 * 领取优惠券
 * @param {*} payload
 */
export const dispatchCouponReceive = payload => createAction({
  url: API_COUPON_RECEIVE,
  type: COUPON_RECEIVE,
  method: 'POST',
  payload
})
